package com.atguigu.jxc.service.impl;


import com.atguigu.jxc.dao.SupplierDao;
import com.atguigu.jxc.dao.SupplierMapper;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import com.atguigu.jxc.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@SuppressWarnings("all")
public class SupplierServiceImpl extends ServiceImpl<SupplierDao, Supplier> implements SupplierService {

    @Autowired
    private SupplierDao supplierDao;
    @Autowired
    private SupplierMapper supplierMapper;


    /**
     * 供应商下拉列表查询
     *
     * @param q
     * @return
     */
    @Override
    public List<Supplier> getComboboxList(String q) {
        QueryWrapper<Supplier> supplierQueryWrapper = new QueryWrapper<>();
        if (StringUtil.isEmpty(q))
            q = "";
        supplierQueryWrapper.like("supplier_name", q);
        List<Supplier> supplierList = supplierMapper.selectList(supplierQueryWrapper);
        return supplierList;
    }
}